package sort;
//
/*
Offer21. 快速排序
* */

public class Offer21exchange {
    public int[] exchange(int[] nums) {
        if(nums.length==0){
            return nums;
        }
        int left=0,right=nums.length-1;
        while(left<right){
            while(left<right && nums[left]%2!=0){
                left++;
            }
            while(left<right && nums[right]%2==0){
                right--;
            }
            int tmp=nums[left];
            nums[left]=nums[right];
            nums[right]=tmp;
        }
        return nums;
    }
}
